package com.wthink.hzgj.home.adapter

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import com.wthink.hzgj.BR
import com.wthink.hzgj.R
import com.wthink.hzgj.home.data.Line
import com.wthink.hzgj.util.adapter.AutoUpdatableAdapter
import com.wthink.hzgj.util.adapter.BaseViewHolder

class LineAdapter : AutoUpdatableAdapter<BaseViewHolder, Line>({ o: Line, n: Line ->
    o.id.equals(n.id) && o.select == n.select
}) {
    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder {

        val dataBinding = DataBindingUtil.inflate<ViewDataBinding>(
            LayoutInflater.from(parent.context),
            R.layout.item_line,
            parent,
            false
        )

        return BaseViewHolder(dataBinding, BR.viewModel)
    }
}